import request from "@/utils/request";
import { useStore } from "@/stores/index1";
import { useStoreData } from "@/stores/data";
const storeData: any = useStoreData();
const store = useStore();

/**
 * 获取地图图层树
 * @returns
 */
export const getCoverage = async () => {
    return await request.get(`/sxnf_team/baseFolder/list?id=${store.baseId}`).then((res) => {
        let data = res.data;
        storeData.treeData = data;
        if (!storeData.treeDefaultKey) {
            storeData.treeDefaultKey = data[0].id;
        }

        return res;
    });
};
/**
 * 修改文件夹名称
 */

export const updateFloaderName = async (data = {}) => {
    return await request.post("/sxnf_team/baseFolder/update", data).then((res) => {
        return res;
    });
};

/**
 * 修改文件锁定状态
 */

export const updateFloaderLock = async (data = {}) => {
    return await request.post("/sxnf_team/baseFolder/modifyTheLockState", data).then((res) => {
        return res;
    });
};

/**
 * 添加文件夹
 */

export const addFloader = async (data = {}) => {
    return await request.post("/sxnf_team/baseFolder/add", data).then((res) => {
        return res;
    });
};

/**
 * 删除文件夹
 */

export const deleteFloader = async (data = {}) => {
    return await request.post("/sxnf_team/baseFolder/deleteById", data).then((res) => {
        return res;
    });
};

/**
 * 删除文件夹所有数据
 */

export const deleteFloaderAllData = async (data = {}) => {
    return await request.post("/sxnf_team/draw/clearFolderContent", data).then((res) => {
        return res;
    });
};
/**
 * 设置标绘显示状态
 */

export const updateFloaderShow = async (data = {}) => {
    return await request.post("/sxnf_team/baseFolder/modifyThePlotDisplay ", data).then((res) => {
        return res;
    });
};
